%%



%{
/* tokens */

%}
/* reg defs */
/* useful stuff */
delim =	[ \t\n\r]
ws =		{delim}+
letter =	[A-Za-z]
digit =	[0-9]

/* tokens */
id =		{letter}({letter}|{digit})*
int =		{digit}+
float =		{digit}+(\.{digit}+)
bool =		(TRUE|FALSE)
time =		@m{digit}+
string =	\"({letter}|{digit}|{ws})*\"

/* more useful stuff */
number =	{int}|{float}

%%

{ws}	{ /* do nothing */ }
;		{ printf ("\n"); /* end of statement */ }
{bool}	{ yylval = 1; printf("Ran across %s\n", yytext); return BOOL; }
TIME_SIGNATURE { yylval = 0; printf("Found a TIME_SIGNATURE\n"); return TIME_SIGNATURE; }
TEMPO   { yylval = 0; printf("Found a TEMPO\n"); return TEMPO; }
{id}	{ yylval = (int) installID(); return ID; }
{int}	{ yylval = (int) installNum(); return INT; }
{float}	{ yylval = (int) installNum(); return FLOAT; }
{time}	{ yylval = 0; printf("Saw time %s\n", yytext); return TIME;}
{string}	{ yylval = 0; printf("Got a string! %s\n", yytext); return STRING; }
"<"			{ yylval = LT_OP; return(LT_OP);}
">"			{ yylval = GT_OP; return(GT_OP);}
"<="		{ yylval = LE_OP; return(LE_OP);}
">="		{ yylval = GE_OP; return(GE_OP);}


/*


package edu.columbia.upbeat;

import java_cup.runtime.*;
import java.io.IOException;

// import edu.columbia.upbeat.UpbeatSym;
// import static edu.columbia.upbeat.UpbeatSym.*;

%%

%class UpbeatLex

%unicode
%line
%column

// %public
%final
// %abstract

// %cupsym UpbeatSym
// %cup
// %cupdebug

%init{
	// TODO: code that goes to constructor
%init}

%{
	private Symbol sym(int type)
	{
		return sym(type, yytext());
	}

	private Symbol sym(int type, Object value)
	{
		return new Symbol(type, yyline, yycolumn, value);
	}

	private void error()
	throws IOException
	{
		throw new IOException("illegal text at line = "+yyline+", column = "+yycolumn+", text = '"+yytext()+"'");
	}
%}

ANY			=	.

%%

{ANY}		{	return sym(ANY); }

*/
